package routes

import (
	"fiberAmisAdmin/controllers/adminSys"
	"github.com/gofiber/fiber/v2"
)

func SetupRoutes(app *fiber.App) {
	// 设置 API 路由组
	//apiR := app.Group("/api")
	//apiR.Get("/test", api.Test)
	//apiR.Get("/text", api.GetText)
	//
	//apiMenu := app.Group("/api/admin/menu")
	//apiMenu.Get("/", new(api.AdminApiController).GetAllMenu)
	//apiMenu.Get("/:id", new(api.AdminApiController).GetMenu)
	//apiMenu.Post("/", new(api.AdminApiController).CreateMenu)
	//apiMenu.Put("/:id", new(api.AdminApiController).UpdateMenu)
	//apiMenu.Delete("/:id", new(api.AdminApiController).DeleteMenu)

	// 设置 Admin 路由组
	adminR := app.Group("admin")
	adminR.Get("/", adminSys.Login)
	adminR.Get("GetCaptcha", adminSys.GetCaptcha)
	adminR.Post("loginServer", new(adminSys.SysAdminController).LoginServer)
	adminR.Get("/index", adminSys.Home)
	adminR.Get("/main", adminSys.Main)
	adminR.Get("/generate-captcha", adminSys.GenerateCaptcha)
	//adminR.Get("/menu", adminSys.Menu)

	//admin资源路由api
	adminGroup := app.Group("/admin")
	//adminGroup.Get("/user", admin.Index)
	//adminGroup.Get("/columns", new(admin.UserController).Columns)
	//adminApiGroup := app.Group("/admin")

	RegisterResourceRoutes(adminGroup, "/menu", &adminSys.BaseSysController{Child: &adminSys.MenuController{}})
	RegisterResourceRoutes(adminGroup, "/user", &adminSys.BaseSysController{Child: &adminSys.UserController{}})
	//RegisterResourceRoutes(adminApiGroup, "/menu", &adminSys.MenuController{})
	//RegisterResourceRoutes(adminApiGroup, "/user", &admin.UserController{})
}
